accountingIntegrationDashboardApp.controller('maintenanceCostCenterCtrl', ['$scope', '$http', '$log', 'serverDataService', function ($scope, $http, $log, serverDataService){ 

    $scope.companies = [];
    $scope.entityName = 'cost-center';

    $scope.setChildScope($scope);

    $scope.renderRecordsFromServer();

    $scope.loadCompanies = function(){
        return $scope.companies.length ? null : serverDataService.getEntityList('company', false)
                .then(function (data){
                    $scope.companies = data.gridRecords;
                });
    };

    //CRUD
    $scope.addCostCenter = function() {
        $scope.inserted = {
          id: null,
          code: null,
          description: null
        };
        $scope.gridRecords.push($scope.inserted);
    };
}]);